package com.lwz.laboratory.controller;

import com.lwz.laboratory.entity.*;
import com.lwz.laboratory.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Collection;
import java.util.List;

@Controller
public class InterviewController {

    @Autowired
    PostService postService;

    @Autowired
    InterviewService interviewService;





    @Autowired
    SignupService signupService;


//确认报名信息
    @RequestMapping("/tointerview/{signid}")
    public String tointerview(@PathVariable("signid")Integer signid, Model model){
        Post post = postService.toface(signid);
        model.addAttribute("post",post);
        return "interview/interview";

    }
//点击开始面试跳转面试成绩填写页面
    @RequestMapping("/startinterview")
    public String startinterview(Signup signup, Model model){
        System.out.println(signup.getSignid());
        signup.setResult("1");
        signupService.EditSignup(signup);
        String stuid =signup.getStuid();
        model.addAttribute("stuid",stuid);
        return "interview/startinterview";

    }



    //查看面试结果

    @RequestMapping("/result/{stuid}")
    public String result(@PathVariable("stuid")String stuid, Model model){
        List<Signup> signups =signupService.findresult(stuid);
        model.addAttribute("signups",signups);
        return "interview/result";

    }






}
